package com.wtcrazy.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wtcrazy.dao.AddressMapper;
import com.wtcrazy.entity.*;
import com.wtcrazy.service.IAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
    @Autowired
    AddressMapper addressMapper;

    @Override
    public Address userAdd(Address address) {
        address.setId(UUID.randomUUID().toString().replace("-", ""));
        addressMapper.userAdd(address);
        return address;
    }

    @Override
    public List<Address> getUserAll(String uid) {
        return addressMapper.getUserAll(uid);
    }

    @Override
    public void modifyUserDefault(Object obj) {
        addressMapper.modifyUserDefault(obj);
    }

    @Override
    public Address getUserDefault(String uid) {
      return   addressMapper.getUserDefault(uid);
    }
}
